package com.leoncom.sms_silencer.util;

import java.util.Calendar;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;

import android.content.Context;

public class CommonUtils {
	public static int DAYS_OF_WEEK = 7;
	
	public static CharSequence[] getDayOfWeekNames(Context ctxt, int style) {
		CharSequence[] weekDayItems = new CharSequence[DAYS_OF_WEEK];
		Calendar t = Calendar.getInstance();
		Locale current = ctxt.getResources().getConfiguration().locale;
		Map<String, Integer> DayNameMaps = t.getDisplayNames(Calendar.DAY_OF_WEEK, style, current);
		for(Entry<String, Integer> entry : DayNameMaps.entrySet()) {
			int index = entry.getValue() - 1;
			if(index < 0 || index >= DAYS_OF_WEEK) {
				return null;
			}
			String DayName = entry.getKey();
			weekDayItems[index] = DayName;
		}
		
		return weekDayItems;
	}
}
